<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
  <style>
    *{margin:0; padding:0;}
    img{border:0;}
    body{font-size:12px; font-family:"宋体", Arial; background:url(/images/user/test/t2.gif) repeat-x;}
    #mainbody{width:820px; margin:0 auto; margin-top:20px; background:url(/images/user/test/bg3.gif) no-repeat;background-color:#69afc3; border-top:2px #FFFFFF solid;border-left:2px #FFFFFF solid;border-right:2px #FFFFFF solid;}
    #head{width:820px; height:88px;}
    #logo{width:220px; height:78px;float:left; margin-top:10px; margin-left:5px;}
    #head_text{width:200px; float:left; height:20px; line-height:20px; margin-top:48px; color:#fff;}
    #content{width:800px; margin:0 auto; margin-top:8px; background-color:#fff;}
    #foot{width:820px; height:64px; margin:0 auto; margin-top:-10px; background-color:#69AFC3;}

    h1{font-size:16px; color:#6F5100;margin-bottom:10px; margin-left:-20px;}
    #data_title{width:610px; height:60px; margin:0 0 0 150px; color:#CC0000; font-size:16px; padding-top:40px; padding-left:80px; font-weight:bold; font-family:"微软雅黑"; line-height:2;}
    #data_title span{font-size:12px; color:#0066FF; font-weight:normal;}
    #data_nav{width:200px; height:22px; line-height:22px; padding-left:30px; margin-left:20px;border:1px solid #000000; background-color:#FFFEEF;}
    #data_top{width:700px; padding:10px; margin:0 auto; margin-top:15px;}
    #data_top p{line-height:20px;}
    #data_img{text-align:center; margin-top:10px;}
    .datalist{border:1px solid #0058a3;border-collapse:collapse; margin:15px auto; background-color:#c7e5ff;}
    .datalist th{border:1px solid #0058a3; height:20px; line-height:20px; background-color:#4bacff; color:#FFFFFF}
    .datalist td{border:1px solid #0058a3; height:20px; line-height:20px; padding-left:10px;}
    .altrow{background-color:#eaf5ff;}

    .result-item{margin: 10px 0 5px 100px}
    table {border:1px solid #000000;border-collapse:collapse; margin:5px 0 0 20px; background-color:#FFFEEF;}
    table .th-style{border:1px solid #000000; height:20px; line-height:20px; background-color:#CF9700; color:#FFFFFF}
    table td{border:1px solid #000000; height:20px; line-height:20px; padding:0 10px 0 10px;}
    table .altrow{background-color:#eaf5ff;}
    .info-datas td{border:1px solid #000000}
  </style>
</head>

<body>
  <div id="mainbody">
  <div id="head">
    <div id="logo">
      <img src="/images/user/test/logo.gif" width="220" height="78" />
    </div>
    <div id="head_text">
      测试量表 beta
    </div>
  </div>

  <div id="content">
    <div id="data_title">
      <!--<span>know yourself</span><br />-->
      <%=@test.name%>测试报告
    </div>

    <div style="margin:0 0 20px 0">

      <table style="margin-left:120px;" class="info-datas">
        <tr>
          <td class="">量表</td>
          <td><%= @test.name %></td>
          <td class="">测量日期</td>
          <td><%= Time.now %> </td>
        </tr>
        <tr>
          <td class="">姓名</td>
          <td><%= safe_user_info.username%> </td>
          <td class="">婚否</td>
          <td><%= safe_user_info.married%> </td>
        </tr>
        <tr>
          <td class="">性别</td>
          <td><%= safe_user_info.gender%> </td>
          <td class="">年龄</td>
          <td><%= safe_user_info.age%> </td>
        </tr>
      </table>
    </div>

    <div class="result-item">
      <h1>总计</h1>
      <p id="data_nav" >
        总分：<%= @total %> &nbsp;&nbsp;&nbsp;&nbsp;
        均分：<%= @avg %>
      </p>
    </div>
   
    <div class="result-item">
      <h1>各题原始分</h1>
      <table>
        <tr>
          <% i = 1 %>
          <% @original_results.each do |o| %>
          <% if i%5 == 1 %>
        </tr>
        <tr>
          <% end %>
          <td>第<%= i %>题:<%= o.value%> </td>
          <% i += 1 %>
          <% end %>
        </tr>

      </table>
    </div>

    <% if @test.has_part == 1 %>
    <div class="result-item">
      <h1>分量表得分</h1>
      <table border="1">
        <tr>
          <td class="th-style">分量表</td>
          <td class="th-style">总分</td>
          <td class="th-style">均分</td>
        </tr>
        <% @part_results.each do |p| %>
        <tr>
          <td><%=Part.find(p.part_id).name%></td>
          <td><%=p.total%></td>
          <td><%=p.avg%></td>
        </tr>
        <% end %>
      </table>

    </div>
    <% end %>

    <div class="result-item">
      <h1> 因子测量内容：</h1>
      <% @dimen_results.each do |d| %>
        <% dimen = Dimen.find(d.dimen.id) %>
        <b><%= dimen.name%>:</b><br/>&nbsp;&nbsp;
        <%= dimen.description%><br/>
      <% end %>
    </div>

    <div class="result-item">
      <h1>因子得分</h1>
      <table border="1">
        <tr>
          <td class="th-style">因子</td>
          <td class="th-style">总分</td>
          <td class="th-style">均分</td>
        </tr>
        <% @dimen_results.each do |d| %>
        <tr>
          <td><%=Dimen.find(d.dimen.id).name%></td>
          <td><%=d.total%></td>
          <td><%=d.avg%></td>
        </tr>
        <% end %>
      </table>

    </div>


    <div class="result-item">
      <h1>常模</h1>

      <% if @test.norm_info.norm_type == NORM_TYPE_TEXT %>
        <%= @test.norm_info.description %>
      <% end %>

      <% if @test.norms.size > 0 %>
      <table border="0" cellspacing="0" cellpadding="0" id="normsTable" class="style_table">
        <% if @test.norm_info.consider_item != NORM_ITEM_TYPE_NUM %>
        <tr class="style_tr">
          <% if @test.norm_info.consider_age %>
          <td></td>
          <% end %>
          <% if @test.norm_info.consider_sex %>
          <td></td>
          <% end %>
          <% for name in @norms[0].attribute_names %>
            <% if name.include?("item")%>
              <% if @test.norm_info.consider_item == NORM_ITEM_TYPE_PART %>
                <td colspan="2"><%= Part.find(name[4, name.length]).name %> </td>
              <% end %>
              <% if @test.norm_info.consider_item == NORM_ITEM_TYPE_DIMEN %>
                <td colspan="2"><%= Dimen.find(name[4, name.length]).name %> </td>
              <% end %>
            <% end %>
          <% end %>
        </tr>
        <% end %>

        <tr>
          <% if @test.norm_info.consider_age %>
          <td>年龄</td>
          <% end %>
          <% if @test.norm_info.consider_sex %>
          <td>性别</td>
          <% end %>
          <% for name in @norms[0].attribute_names %>
            <% if name.include?("item")%>
            <td class="style_x">X</td>
            <td class="style_sd">SD</td>
            <% end %>
          <% end %>
        </tr>

        <% for norm in @norms %>
        <tr>
          <% if @test.norm_info.consider_age %>
          <td><%= norm["age"]%> </td>
          <% end %>
          <% if @test.norm_info.consider_sex %>
          <td><%= norm["sex"] %> </td>
          <% end %>
          <% for name in @norms[0].attribute_names %>
            <% if name.include?("item")%>
            <td class="style_x"><%= norm[name].split(",")[0] %></td>
            <td class="style_sd"><%= norm[name].split(",")[1] %></td>
            <% end %>
          <% end%>
        </tr>
        <% end %>
      </table>
      
      <% end %>
      
      <%= @test.norm_info.description %>
    </div>

    <div class="result-item">
      <h1>信效度</h1>
      <p>
        <%= @test.reliability %>
      </p>
    </div>

  </div>

</div>


  <div id="foot">

  </div>

</body>
</html>
